// 组件库入口文件
// 统一导出所有组件、工具和类型

// 基础组件系统
export * from './base/BaseComponent';

// 组件注册系统
export * from './registry/ComponentRegistry';

// 主题系统
export * from './theme/ThemeProvider';

// 响应式布局系统
export * from './layout/ResponsiveLayout';

// 组件工厂
export * from './factory/ComponentFactory';

// 现有的布局组件
export * from './Layout/Panel';

// 组件库初始化函数
export const initializeComponentLibrary = () => {
  console.log('🎨 Initializing component library...');
  
  // 注册默认主题
  // 这里可以添加主题注册逻辑
  
  // 预加载关键组件
  // 这里可以添加组件预加载逻辑
  
  console.log('✅ Component library initialized');
};

// 组件库配置
export const componentLibraryConfig = {
  version: '1.0.0',
  name: 'CodeGraph UI',
  description: 'CodeGraph Editor Component Library',
  features: [
    'Responsive Design',
    'Theme Support',
    'Performance Optimization',
    'Accessibility',
    'Error Boundaries',
    'Component Registry',
    'Development Tools',
  ],
};

// 开发工具
export const componentDevTools = {
  // 列出所有注册的组件
  listComponents: () => {
    const { componentRegistry } = require('./registry/ComponentRegistry');
    const stats = componentRegistry.getStats();
    console.group('📦 Registered Components');
    console.log('Total:', stats.total);
    console.log('By Category:', stats.byCategory);
    console.log('Loaded:', stats.loaded);
    console.log('Preloaded:', stats.preloaded);
    console.groupEnd();
    return stats;
  },
  
  // 分析组件性能
  analyzePerformance: () => {
    console.log('📊 Component performance analysis...');
    // 这里可以添加性能分析逻辑
  },
  
  // 主题调试
  debugThemes: () => {
    console.log('🎨 Theme debugging...');
    // 这里可以添加主题调试逻辑
  },
  
  // 布局调试
  debugLayout: () => {
    console.log('📐 Layout debugging...');
    // 这里可以添加布局调试逻辑
  },
};

// 在开发环境下暴露到全局
if (process.env.NODE_ENV === 'development') {
  (window as any).componentDevTools = componentDevTools;
  console.log('🛠️ Component dev tools available at window.componentDevTools');
}

// 默认导出
export default {
  initializeComponentLibrary,
  componentLibraryConfig,
  componentDevTools,
};
